{extend name='app' /}
{block name='title'}用户列表{/block}

{block name="stylesheet"}
{/block}


{block name="breadcrumb"}
<div class="row wrapper border-bottom white-bg page-heading">
    <div class="col-lg-10">
        <h2>用户列表</h2>
        <ol class="breadcrumb">
            <li class="breadcrumb-item">
                <a>用户管理</a>
            </li>
            <li class="breadcrumb-item active">
                <strong>用户列表</strong>
            </li>
        </ol>
    </div>
</div>
{/block}


{block name="content"}
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row">
        <div class="col-lg-12">
            <div class="ibox ">

                <form id="block-search">
                    <div class="row ">
                        <div class="col-sm-2">
                            <div class="form-group">
                                <label class="control-label">用户昵称</label>
                                <input placeholder="请输入用户昵称" type="text" class="form-control" name="name" value="{$search['name'] ?? ''}">
                            </div>
                        </div>
                        <div class="col-sm-2">
                            <div class="form-group">
                                <label class="control-label">手机号码</label>
                                <input placeholder="请输入手机号码" type="text" class="form-control" name="mobile" value="{$search['mobile'] ?? ''}">
                            </div>
                        </div>

                    </div>
                    <div class="row m-b-lg">
                        <div class="col-sm btn-group-search">
                            <button class="btn btn-primary btn-sm" type="submit">确定</button>
                            <button class="btn btn-white btn-sm btn-reset" type="button">重置</button>
                        </div>
                    </div>
                </form>
                <div class="ibox-content">
                    <div class="row">
                        <div class="col-sm m-b-sm">
                            <span class="float-right">
                                    <button class="btn btn-white btn-sm btn-outline btn-search" type="button"><i
                                            class="fa fa-search"></i>&nbsp;搜索
                                    </button>
                            </span>
                        </div>
                    </div>

                    <div class="table-responsive">
                        <table class="table table-bordered table-hover">
                            <thead>
                            <tr>
                                <th>ID</th>
                                <th>昵称</th>
                                <th>性别</th>
                                <th>头像</th>
                                <th>手机号码</th>
                                <th>段位</th>
                                <th>积分</th>
                                <th>累计积分</th>
                                <th>最后登入时间</th>
                                <th>加入时间</th>
                            </tr>
                            </thead>
                            <tbody>
                            {foreach $list as $item}
                            <tr>
                                <td>{$item->id}</td>
                                <td>{$item->nickname}</td>
                                <td>{if $item->sex==2}女{elseif $item->sex==1}男{else/}未知{/if}</td>
                                <td><img src="{$item->headimg}" alt="" width="80"></td>
                                <td>{$item->mobile}</td>
                                <td>
                                    <select class="chosen-select"  onchange="change_data1('{$Think.config.admin.app_host}/admin/user/renew/{$item->id}',{'level_id':$(this).val()})">
                                        {foreach $level as $value}
                                            <option  value="{$value->id}" {if $item->level_id == $value->id} selected {/if}>{$value->name}</option>
                                        {/foreach}
                                    </select>
                                </td>
                                <td>{$item->integral}</td>
                                <td>{$item->integral_add}</td>
                                <td>{$item->login_time}</td>
                                <td>{$item->create_time}</td>
                            </tr>
                            {/foreach}
                            </tbody>
                        </table>
                        <div class="float-right">
                            {$list|raw}
                        </div>
                    </div>
                </div>
            </div>
        </div>

    </div>
</div>
{/block}

{block name="script"}
<script>

    function change_data1(url, data) {
        if (!data) {
            data = {};
        }
        let response = post_request(url, data);
        if (response.status == 1) {
            show_tip('提示', response.msg, 'success');
        } else {
            show_tip('提示', response.msg, 'error');
        }
    }
</script>
{/block}
